package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetOrderListByTradingIdBean;
import com.ymatou.query.trading.api.service.GetOrderListByTradingIdCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.utils.constant.ECode;

/**
 * 根据交易号获取订单列表 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetOrderListByTradingId {
	private static GetOrderListByTradingIdBean golbtibean;
	private static GetOrderListByTradingIdCall golbticall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("根据交易号获取订单列表");
	}

	@Before
	public void caseUp() {
		golbtibean = new GetOrderListByTradingIdBean();
		golbticall = new GetOrderListByTradingIdCall();

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(golbticall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderListByTradingId_001() {
		Logger.start(true,"根据交易号获取订单列表成功");
		try {
			/*
			 * Map map = new OrderCallService().createOrder(1); int BuyerId =
			 * (Integer) map.get("UserId");
			 */
			int BuyerId = 4085; // sit
			Logger.comment("买家ID:" + BuyerId);
			golbtibean.setBuyerId(BuyerId);
			// int TradingId = (Integer) map.get("TradingId");
			int TradingId = 8044219;// sit
			Logger.comment("交易ID:" + TradingId);
			golbtibean.setTradingId(TradingId);
			// 发送请求
			golbticall.setData(golbtibean);
			golbticall.callService();
			Logger.comment("golbticall send:" + golbticall.getEntityString());
			Logger.comment("golbticall response:" + golbticall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, golbticall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG2, golbticall.getMsg(),
			// "验证Msg");
			Logger.verifyEquals(1, golbticall.getOrderInfoList().size(), "验证查询结果列表长度");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}